package com.i.MyString;
/**
 * 练习9-10：内部类和匿名内部的使用*/
public class TestLamp {
    public static void main(String[] args) {
        Lamp lamp=new Lamp();
        class RedLight implements Light{

            @Override
            public void mine() {
                System.out.println("shine in red");
            }
        }
        lamp.on(new RedLight());
        lamp.on(new Light(){
             @Override
             public void mine() {
                 System.out.println("shine in yellow");
             }
        });
    }
}
interface Light{
    void mine();
}
class Lamp{

    public void on(Light light){
        light.mine();
    }
}